﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Milan;

namespace milaninstaller
{
	public partial class FormStart : Form
	{
		public FormStart()
		{
			InitializeComponent();
		}

		private void buttonCancel_Click(object sender, EventArgs e)
		{
			Close();
		}

		private void buttonInstall_Click(object sender, EventArgs e)
		{
			Downloader downloader = new Downloader(textBoxLocation.Text);
			downloader.Download();
			Close();
		}

		private void FormStart_Load(object sender, EventArgs e)
		{
			textBoxLocation.Text = Downloader.DefaultGetAllUsersProgramDirectory();
			labelProductName.Text = Settings.ProductName.Replace('_', ' ');
			labelCompany.Text = Settings.CompanyName;
			labelVersion.Text = Settings.ProductVersion.ToString();
			Directory.CreateDirectory(textBoxLocation.Text);
		}

		private void buttonBrowse_Click(object sender, EventArgs e)
		{
			var browse = new FolderBrowserDialog();
			browse.SelectedPath = textBoxLocation.Text;
			if(browse.ShowDialog()==DialogResult.OK)
				textBoxLocation.Text = browse.SelectedPath;
		}
	}
}
